#include "DetourNode.h"
#ifdef __cplusplus
extern "C" {
#endif
void nav_dtNode_Delete(dtNode * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtNode_DeleteArray(dtNode * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtNode * nav_NewdtNode(){
	dtNode* wrap_out = new dtNode();
	return wrap_out;
}

unsigned int nav_dtNode_GetBitFieldOfFlags(dtNode * c_this){
	return (unsigned int)(c_this->flags);
}

unsigned int nav_dtNode_GetBitFieldOfPidx(dtNode * c_this){
	return (unsigned int)(c_this->pidx);
}

unsigned int nav_dtNode_GetBitFieldOfState(dtNode * c_this){
	return (unsigned int)(c_this->state);
}

float * nav_dtNode_GetPtrToCost(dtNode * c_this){
	return (float *)(&(c_this->cost));
}

dtPolyRef * nav_dtNode_GetPtrToId(dtNode * c_this){
	return (dtPolyRef *)(&(c_this->id));
}

float(*nav_dtNode_GetPtrToPos(dtNode * c_this))[3]{
	return (float(*)[3])(&(c_this->pos));
}

float * nav_dtNode_GetPtrToTotal(dtNode * c_this){
	return (float *)(&(c_this->total));
}

dtNode * nav_dtNode_IndexArray(dtNode * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtNode_SetFieldOfFlags(dtNode * c_this,unsigned int value){
	c_this->flags=value;
}

void nav_dtNode_SetFieldOfPidx(dtNode * c_this,unsigned int value){
	c_this->pidx=value;
}

void nav_dtNode_SetFieldOfState(dtNode * c_this,unsigned int value){
	c_this->state=value;
}

void nav_dtNodePool_clear(dtNodePool * c_this){
	c_this->clear();
}

void nav_dtNodePool_Delete(dtNodePool * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtNodePool_DeleteArray(dtNodePool * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtNodePool * nav_NewdtNodePool(int maxNodes,int hashSize){
	int c_arg_maxNodes=maxNodes;
	int c_arg_hashSize=hashSize;
	dtNodePool* wrap_out = new dtNodePool(c_arg_maxNodes,c_arg_hashSize);
	return wrap_out;
}

dtNode * nav_dtNodePool_findNode(dtNodePool * c_this,dtPolyRef id,unsigned char state){
	dtPolyRef c_arg_id=id;
	unsigned char c_arg_state=state;
	dtNode * c_out = c_this->findNode(c_arg_id,c_arg_state);
	dtNode * wrap_out  = (dtNode *)(void*)(c_out);
	return wrap_out;
}

unsigned int nav_dtNodePool_findNodes(dtNodePool * c_this,dtPolyRef id,dtNode * * nodes,int const maxNodes){
	dtPolyRef c_arg_id=id;
	dtNode * * c_arg_nodes=(dtNode * *)(void*)(nodes);
	int const c_arg_maxNodes=maxNodes;
	unsigned int c_out = c_this->findNodes(c_arg_id,c_arg_nodes,c_arg_maxNodes);
	unsigned int wrap_out  = (c_out);
	return wrap_out;
}

dtNodeIndex nav_dtNodePool_getFirst(dtNodePool const * c_this,int bucket){
	int c_arg_bucket=bucket;
	dtNodeIndex c_out = c_this->getFirst(c_arg_bucket);
	dtNodeIndex wrap_out  = (c_out);
	return wrap_out;
}

int nav_dtNodePool_getHashSize(dtNodePool const * c_this){
	int c_out = c_this->getHashSize();
	int wrap_out  = (c_out);
	return wrap_out;
}

int nav_dtNodePool_getMaxNodes(dtNodePool const * c_this){
	int c_out = c_this->getMaxNodes();
	int wrap_out  = (c_out);
	return wrap_out;
}

int nav_dtNodePool_getMemUsed(dtNodePool const * c_this){
	int c_out = c_this->getMemUsed();
	int wrap_out  = (c_out);
	return wrap_out;
}

dtNodeIndex nav_dtNodePool_getNext(dtNodePool const * c_this,int i){
	int c_arg_i=i;
	dtNodeIndex c_out = c_this->getNext(c_arg_i);
	dtNodeIndex wrap_out  = (c_out);
	return wrap_out;
}

dtNode * nav_dtNodePool_getNode(dtNodePool * c_this,dtPolyRef id,unsigned char state){
	dtPolyRef c_arg_id=id;
	unsigned char c_arg_state=state;
	dtNode * c_out = c_this->getNode(c_arg_id,c_arg_state);
	dtNode * wrap_out  = (dtNode *)(void*)(c_out);
	return wrap_out;
}

dtNode * nav_dtNodePool_getNodeAtIdx(dtNodePool * c_this,unsigned int idx){
	unsigned int c_arg_idx=idx;
	dtNode * c_out = c_this->getNodeAtIdx(c_arg_idx);
	dtNode * wrap_out  = (dtNode *)(void*)(c_out);
	return wrap_out;
}

dtNode const * nav_dtNodePool_getNodeAtIdx11(dtNodePool const * c_this,unsigned int idx){
	unsigned int c_arg_idx=idx;
	dtNode const * c_out = c_this->getNodeAtIdx(c_arg_idx);
	dtNode const * wrap_out  = (dtNode const *)(void*)(c_out);
	return wrap_out;
}

int nav_dtNodePool_getNodeCount(dtNodePool const * c_this){
	int c_out = c_this->getNodeCount();
	int wrap_out  = (c_out);
	return wrap_out;
}

unsigned int nav_dtNodePool_getNodeIdx(dtNodePool const * c_this,dtNode const * node){
	dtNode const * c_arg_node=(dtNode const *)(void*)(node);
	unsigned int c_out = c_this->getNodeIdx(c_arg_node);
	unsigned int wrap_out  = (c_out);
	return wrap_out;
}

dtNodePool * nav_dtNodePool_IndexArray(dtNodePool * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtNodeQueue_clear(dtNodeQueue * c_this){
	c_this->clear();
}

void nav_dtNodeQueue_Delete(dtNodeQueue * c_this){
	if(c_this==0){
	    return;
	}
	delete c_this;
}

void nav_dtNodeQueue_DeleteArray(dtNodeQueue * c_this){
	if(c_this==0){
		return;
	}
	delete []c_this;
}

dtNodeQueue * nav_NewdtNodeQueue(int n){
	int c_arg_n=n;
	dtNodeQueue* wrap_out = new dtNodeQueue(c_arg_n);
	return wrap_out;
}

bool nav_dtNodeQueue_empty(dtNodeQueue const * c_this){
	bool c_out = c_this->empty();
	bool wrap_out  = (c_out);
	return wrap_out;
}

int nav_dtNodeQueue_getCapacity(dtNodeQueue const * c_this){
	int c_out = c_this->getCapacity();
	int wrap_out  = (c_out);
	return wrap_out;
}

int nav_dtNodeQueue_getMemUsed(dtNodeQueue const * c_this){
	int c_out = c_this->getMemUsed();
	int wrap_out  = (c_out);
	return wrap_out;
}

dtNodeQueue * nav_dtNodeQueue_IndexArray(dtNodeQueue * c_this,long n){
	if(c_this==0){
		return 0;
	}
	c_this+=n;
	return c_this;
}

void nav_dtNodeQueue_modify(dtNodeQueue * c_this,dtNode * node){
	dtNode * c_arg_node=(dtNode *)(void*)(node);
	c_this->modify(c_arg_node);
}

dtNode * nav_dtNodeQueue_pop(dtNodeQueue * c_this){
	dtNode * c_out = c_this->pop();
	dtNode * wrap_out  = (dtNode *)(void*)(c_out);
	return wrap_out;
}

void nav_dtNodeQueue_push(dtNodeQueue * c_this,dtNode * node){
	dtNode * c_arg_node=(dtNode *)(void*)(node);
	c_this->push(c_arg_node);
}

dtNode * nav_dtNodeQueue_top(dtNodeQueue * c_this){
	dtNode * c_out = c_this->top();
	dtNode * wrap_out  = (dtNode *)(void*)(c_out);
	return wrap_out;
}

dtNode * nav_NewDtNodePtrArray(long n){
	dtNode* c_this=new dtNode[n];
	return c_this;
}

#ifdef __cplusplus
}
#endif
